﻿#ifndef YTOOLWIDGET_H
#define YTOOLWIDGET_H

#include <QWidget>

class YToolWidget : public QWidget
{
    Q_OBJECT
public:
    explicit YToolWidget(QWidget *parent = nullptr);

    void set(const QRect& rect, const QRect& originScreenRect);
    void set(const QPoint& pos, const QRect& originScreenRect, const QSize& size = QSize());
    void unset();
    inline QSize getDesktopSize() { return desktopSize; }

    // add by liq 12
    void showTool();
    void raiseTool();
    void hideTool();
    void onReferRectChanged(const QRect &rect);
    void adjustPos();

public:
    bool toped = false;

// add by liq 12
private:
    QRect referRect_;

protected:
    virtual void timeout();
    QSize desktopSize;
    virtual void mousePressEvent(QMouseEvent *e);

};

#endif // YTOOLWIDGET_H
